package com.hopu.oa.dao.mail;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hopu.oa.entity.mail.AoaMailnumber;
import com.hopu.oa.entity.management.AoaStatusList;
import com.hopu.oa.entity.management.AoaTypeList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface AoaMailnumberDao extends BaseMapper<AoaMailnumber> {
    List<AoaMailnumber> selectAllAoaMail(@Param("userId") Integer userId, String baseKey, @Param("index") Integer index, @Param("size") Integer size, Integer type, Integer status, Integer time);

    @Select("select type_name from aoa_type_list where type_id=#{mailType}")
    String getTypeName(int mailType);

    @Select("select status_name from aoa_status_list where status_id=#{status}")
    String getStatusName(int status);

    @Select("select * from aoa_type_list where type_id=1 or type_id=2")
    List<AoaTypeList> getType();

    @Select("select * from aoa_status_list where status_id=1 or status_id=2")
    List<AoaStatusList> getStatus();

    @Select("select * from aoa_mailnumber where  mail_number_id=#{mailNumberId}")
    AoaMailnumber selectMailByID(@Param("mailNumberId") int mailNumberId);

    @Select("select * from aoa_mailnumber where mail_num_user_id = #{userId}")
    List<AoaMailnumber> selectAoaMailnumber(Integer userId);

    @Select("select * from aoa_mailnumber where mail_num_user_id != #{userId}")
    List<AoaMailnumber> selectAoaMailnumberSend(Integer userId);


}